package edu.vt.sdm.tcga.filenavigator.model;

import java.io.File;

public class FileBean {

	File file;
	String fullFilePath;
	
	public FileBean(File file){
		this.file = file;
		this.fullFilePath = file.getAbsolutePath();
	}
	
	@Override
	public String toString(){
		return file.getName();
	}
	
	public String getFullFilePath(){
		return this.fullFilePath;
	}
	
	public boolean isDirectory(){
		return file.isDirectory();
	}
	
	public boolean hasChildren(){
		return file.list() != null;
	}
	
	public FileBean[] getChildren(){
		
		File[] files = file.listFiles();
		FileBean[] fileBeans = new FileBean[files.length];
		
		for(int i=0; i<files.length; i++){
			
			FileBean bean = new FileBean(files[i]);
			fileBeans[i] = bean;
		}
		
		return fileBeans;
	}

}
